using System;

namespace LDNS.Models
{
    /// <summary>
    /// DNS缓存统计模型
    /// 作者：huobing
    /// </summary>
    public class DnsCacheStatistics
    {
        /// <summary>
        /// 缓存项总数
        /// </summary>
        public int TotalItems { get; set; } = 0;
        
        /// <summary>
        /// 有效缓存项数量
        /// </summary>
        public int ValidItems { get; set; } = 0;
        
        /// <summary>
        /// 过期缓存项数量
        /// </summary>
        public int ExpiredItems { get; set; } = 0;
        
        /// <summary>
        /// 缓存命中次数
        /// </summary>
        public int HitCount { get; set; } = 0;
        
        /// <summary>
        /// 缓存未命中次数
        /// </summary>
        public int MissCount { get; set; } = 0;
        
        /// <summary>
        /// 总查询次数
        /// </summary>
        public int TotalQueries { get; set; } = 0;
        
        /// <summary>
        /// 缓存命中次数（别名，与HitCount相同）
        /// </summary>
        public int CacheHits => HitCount;
        
        /// <summary>
        /// 命中率
        /// </summary>
        public double HitRate => TotalQueries > 0 ? (double)HitCount / TotalQueries * 100 : 0;
        
        /// <summary>
        /// 缓存总大小（字节）
        /// </summary>
        public long TotalSize { get; set; } = 0;
        
        /// <summary>
        /// 平均TTL（秒）
        /// </summary>
        public double AverageTtl { get; set; } = 0;
        
        /// <summary>
        /// 最后清理时间
        /// </summary>
        public DateTime LastCleanup { get; set; } = DateTime.Now;
    }
}